Return to doc.sitecore.com

4.  Master
Prev Next

Masters separate Item creation logic from Template structure.  The separation of Template from Master allows Templates to be used for a greater variety of purposes, which can result in fewer Templates requiring maintenance. 

In general each Master is associated with a Template, and the Fields defined on the Template define the fields which appear on the Master.

In object-oriented programming terms a Sitecore Master is most like a constructor, defining default field values, layout, security and other settings applied to new Items created from the Master.  Masters function like on-insert triggers in a relational database.

When a user creates a new Item based on a Master, Sitecore basically copies that Master to the location of the new Item and expands certain tokens in the Master such as $name (the name entered by the user when creating the new Item), $parentname (the name of the parent of the new item), $id (the GUID of the new item) and $parentid (the GUID of the parent of the new Item).  Because changes do not propagate through the system when Masters change, in general layout settings should not be set on Masters but rather on Templates (from which such settings are inherited).  If the “Copy Parent Rights” checkbox is selected on the Master, security from the parent will be applied to the new Item; otherwise the security settings specified on the Master will be copied with the rest of the data in the Master.

Masters are used to:

As an example of when multiple Masters for a single Template might be useful, consider a section of the website that has at least two types of users: anonymous users and authenticated members of various audience segments.  A section of this website contains many Items of the same data type (based on the same Template); most are available to anonymous users but some are only available to authenticated members of the various groups.  To make it easier for CMS users to add both items which are available to anonymous users and items which are available to members of the various groups, one master would be implemented with permissions open to anonymous users, another with permissions set such that only members of a specific group can view that content.  When a user creates a new Item from a Master, they will choose either the anonymous Master or the restricted Master – in this way they do not have to explicitly set permissions on the new Items.


Prev Next